<%@ page contentType="text/html; charset=UTF-8" %>
<%@ page language="java" import="java.util.*" %>
<jsp:directive.page import="com.xr.common.CommUtil"/>
<jsp:directive.page import="com.bstek.dorado.data.db.*"/>
<jsp:directive.page import="com.bstek.dorado.utils.variant.VariantSet"/>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>人员分布</title>
<script language="javascript" src="<%=request.getContextPath()%>/dorado/smartweb2.loadUserLib.d?file=/lib/jquery1.8.2.min.js"></script>
 <script  src="<%=request.getContextPath()%>/dorado/smartweb2.loadUserLib.d?file=/lib/highcharts2.3.5.js"></script>
<script   src="<%=request.getContextPath()%>/dorado/smartweb2.loadUserLib.d?file=/lib/exporting2.3.5.js"></script>
<script type="text/javascript"> 
		 	<%
		 	DBStatement dbs=new DBStatement();
		String costY="",incomeY="",xMonth="",sql="",series="";
 
		
		VariantSet vs=null;
	 
 
		sql="select (select city_name from pb_city where city_id=work_city_id)city,cc from("+
"select distinct work_city_id,count(1)cc from org_onoff_station where  status=2 group by work_city_id )";
		dbs.setSql(sql);
		List listM=dbs.queryForList();
		for(int i=0;i<listM.size();i++){
		  VariantSet vs1=(VariantSet)listM.get(i);
		  xMonth+="'"+(vs1.getString("city")==null?"未设置":vs1.getString("city"))+"',";
		  
		  costY+= vs1.getString("cc")+","; 
		 series+="{name:'"+(vs1.getString("city")==null?"未设置":vs1.getString("city"))+"',data:["+vs1.getString("cc")+"]},";
		}
		xMonth=xMonth.substring(0,xMonth.length()-1); 
	
		// series+="{name:'城市',data:["+costY.substring(0,costY.length()-1)+"]},";

		 
	
		dbs.close();
			 
		series=series.substring(0,series.length()-1); 
			  
		%>
		
		var chart;
			$(document).ready(function() {
				chart = new Highcharts.Chart({
					chart: {
						renderTo: 'container',
						defaultSeriesType: 'column'
					},
					title: {
						text: '员工分布图'
					},
					subtitle: {
						text: ''
					},
					xAxis: {
						categories: [<%=xMonth%>],
						tickWidth: 0,
						gridLineWidth: 0,
						labels: {
							align: 'left',
							x: 0,
							y: 50 
						}
					 
					},
					yAxis: {
						title: {
							text: '人数'
						}
					},
					
					tooltip: {
						formatter: function() {
							return ''+
								 this.series.name +': '+ this.y +' 人';
						}
					},
					legend: {
						layout: 'vertical',
						backgroundColor: '#FFFFFF',
						align: 'left',
						verticalAlign: 'top',
						x: 150,
						y: 300,
						floating: true,
						shadow: true
					},
					plotOptions: {
						column: {
							pointPadding: 0.1,
							borderWidth: 0
						}
					},
					credits: {
						enabled: false
					},
					series: [<%=series%>]
				});
				
				
			});
				
		</script>

  </head>
  
  <body>
    <div id="container" style="width: 100%; height: 100%; margin: 0 auto"></div>

  </body>
</html>
